/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-22 11:40:57
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-22 13:23:58
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/controller/visitor_controller.dart';
import 'package:flutter_data_center/model/visitor/visitor_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';

class VisitorItem extends StatelessWidget {
  const VisitorItem({Key key, this.visitor, this.controller}) : super(key: key);
  final Visitor visitor;
  final VisitorController controller;

  @override
  Widget build(BuildContext context) => InkWell(
        onTap: () {
          // NavigatorUtils.pushPageByFade(
          //   context: context,
          //   targetPage: TeacherDetailAttendanceScreen(),
          //   isReplace: false,
          //   startMills: 500,
          // );
        },
        child: ListTile(
          isThreeLine: false,
          minLeadingWidth: 50,
          leading: Container(
            width: 50,
            height: 50,
            child: ClipRRect(
              borderRadius: BorderRadius.circular(10),
              child: Image.network(
                visitor.avatar,
                fit: BoxFit.cover,
              ),
            ),
          ),
          title: Text(
            visitor.name,
            style: TextStyle(
              color: Colors.black,
              fontSize: 18,
              fontWeight: FontWeight.w400,
            ),
          ),
          subtitle: Text(
            visitor.desc,
            style: TextStyle(
              color: gColor('#A2B0A9'),
              fontSize: 12,
            ),
          ),
          trailing: Column(
            children: [
              Container(
                width: 46,
                alignment: Alignment.center,
                height: 20,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    color: visitor.status == "in"
                        ? gColor("#08D187")
                        : gColor("#BFBFBF"),
                    boxShadow: [
                      BoxShadow(
                        offset: Offset(0, 0),
                        blurRadius: 4,
                        color: Color.fromRGBO(0, 0, 0, 0.25),
                      ),
                    ]),
                child: Text(
                  controller.status[visitor.status],
                  style: TextStyle(
                    fontSize: 10,
                    height: 1,
                    color: Colors.white,
                  ),
                ),
              ),
              SizedBox(height: 10),
              Text(
                visitor.time,
                style: TextStyle(
                  fontSize: 16,
                  height: 1,
                  color: gColor("#A2B0A9"),
                ),
              ),
            ],
          ),
        ),
      );
}
